package com.wuyu.mini.dubbo.cluster.loadbalance;

import com.wuyu.mini.dubbo.cluster.AbstractLoadBalance;
import java.util.List;
import java.util.Random;

/**
 * 随机负载
 * @author wuyu
 */
public class RandomLoadBalanceImpl extends AbstractLoadBalance {

        @Override
        public String doSelect(List<String> providers) {
            int len = providers.size();
            Random random = new Random();
            int lucky = random.nextInt(len);
            return providers.get(lucky);
        }
}
